#{extends 'main.html' /} #{set title:'Home' /}

<body style="background-color: white;">
	<h1>
		<font size="3" face="New times roman" color="red"> <i> Here
				all members to add : </i> </font>
	</h1>

	#{ifnot usersByMail}
	<p>There are no members with this mail!!</p>
	#{/ifnot} #{list items:usersByMail, as:'RegisteredUser'}
	<form action="@{CommunityLists.ActionToAdd()}">

		<div id="${RegisteredUser.id}">
			<ul>
				<li>
					<h4>${RegisteredUser.name}</h4></li>
			</ul>
			<ul>
				<h4>${RegisteredUser.mail}</h4>
			</ul>
			#{if models.RegisteredUser.findById(RegisteredUser.id).CommunityLists.contains(models.CommunityList.findById(commId))}
			<p>already a member</p>
			#{/if} 
			
			#{if models.RegisteredUser.findById(RegisteredUser.id) == models.CommunityList.findById(commId).creator}
			<p>Creator of ${models.CommunityList.findById(commId).name} communityList</p>
			#{/if} 
			
			#{if !(models.RegisteredUser.findById(RegisteredUser.id).CommunityLists.contains(models.CommunityList.findById(commId)))}
			#{if !(models.RegisteredUser.findById(RegisteredUser.id) == models.CommunityList.findById(commId).creator)}
			<button name="add" type="submit" value="${RegisteredUser.id}">Add</button>
			#{/if}#{/if}
			<br>
			

			<hr>
		</div>
	</form>
	#{/list}


	<a href="@{CommunityLists.addMembersToMyCommList()}">Back to search
		page</a>
	<br>
	<a href="@{Application.viewprofile()}">Back to Profile Page</a>

</body>